#ifndef TJ_FORM_RECIPE_CHECK_H
#define TJ_FORM_RECIPE_CHECK_H

#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkInterface>
#include <QNetworkRequest>
#include <QJsonObject>
#include <QJsonArray>
#include <QSqlQuery>
#include <QMap>
#include <QSqlQueryModel>
#include <QSoundEffect>


namespace Ui {
class tj_form_recipe_check;
}

class tj_form_recipe_check : public QWidget
{
    Q_OBJECT

public:
    explicit tj_form_recipe_check(QWidget *parent = nullptr);
    ~tj_form_recipe_check();

    void closeEvent(QCloseEvent *event);

signals:
    void destroyW( QString );

private slots:

    void processData(QString recipe_no);

    QString get_recipe_no(QString);

    void tm_code_input_timeout();

    void recipe_compare();

    void on_le_recipe_no_returnPressed();

    void on_le_code_returnPressed();

    void on_pb_item_add_clicked();

    void on_pb_fresh_recipe_clicked();

    void on_pb_exit_clicked();

    void on_tv_recipe_list_clicked(const QModelIndex &index);

    void on_tv_recipe_list_doubleClicked(const QModelIndex &index);

    void on_tv_recipe_content_clicked(const QModelIndex &index);

    void on_tv_recipe_content_doubleClicked(const QModelIndex &index);

    void on_pb_save_clicked();

    void on_le_code_textChanged(const QString &arg1);

    void on_pb_get_ret_code_clicked();

    void on_cbb_terminal_currentTextChanged(const QString &arg1);

private:
    Ui::tj_form_recipe_check *ui;

    QSqlQuery *qrm, *qrmt, *qro, *qrot;

    QString sq;
    QSqlQueryModel *md_recipe_list, *md_recipe_content;
    QNetworkRequest request;
    QNetworkAccessManager manager ;

    QMap<QString, QString> drug_info;
    QString cur_clinic_code, cur_recipe_no,cur_card_no;
    //QMap<QString, QString> recipe_info;

    bool recipe_finished;   //处方调配完成标志
    bool is_repair;   //处方初录状态
    QSoundEffect snd_reci_finish ;
    QSoundEffect snd_drug_finish ;

    QSoundEffect snd_error;
    QTimer *tm_code_input;
    QString current_status;

    QString terminalCode, terminalName, deptCode;

};

#endif // TJ_FORM_RECIPE_CHECK_H
